exports.CreateOrderTask=function(_args)
{
	var pathimage=Ti.App.Properties.getString('pathimage');
	var view = Ti.UI.createView({
		 borderColor: Ti.App.Properties.getString('borderColor'),
	     borderRadius: Ti.App.Properties.getInt('borderRadius'),
	     borderWidth:Ti.App.Properties.getInt('borderWidth'),
		width:_args.width,
		height:_args.height,
		backgroundColor:'#e3e3e3',//'#a9a9a9',
		top:0,
		left:_args.left,
		
	})
	
	
	var platformWidth=Titanium.Platform.displayCaps.platformWidth;//Ti.App.Properties.getInt('platformWidth');
	var platformHeight=Titanium.Platform.displayCaps.platformHeight;//Ti.App.Properties.getInt('platformHeight');
	
	//////////////////Task//////////

	var bt_height=_args.width;//Ti.App.Properties.getInt('Order_buttonnumber_height')
	var top_row1=0;
	var top_row2=bt_height;
	var top_row3=2*bt_height;

	
	var bts=[
		{title:'Đổi bàn',value:1,func:'',top:top_row1,backgroundImage:pathimage+'change.png',backgroundSelectedImage:pathimage+'change_press.png'},
		{title:'In HD',value:2,func:'',top:top_row2,backgroundImage:pathimage+'print.png',backgroundSelectedImage:pathimage+'print_press.png'},
		{title:'Ghi chú phiếu',value:3,func:'',	  top:top_row3,backgroundImage:pathimage+'note.png',backgroundSelectedImage:pathimage+'note_press.png'},
	]
	var createButton = function (bt) {
		var bt = Titanium.UI.createButton({
			 backgroundColor:'#e3e3e3',
		     borderColor: Ti.App.Properties.getString('borderColor'),
		     borderRadius: Ti.App.Properties.getInt('borderRadius'),
		     borderWidth:Ti.App.Properties.getInt('borderWidth'),
			 color:'Black',
			 backgroundImage:bt.backgroundImage,
			 backgroundSelectedImage:bt.backgroundSelectedImage,
			 width:_args.width,
		 	 height:	bt_height,
		   	 top:bt.top,
		   	 left:0,
		   	 value:bt.value
		}); 
		bt.addEventListener('click', function (e) {
			//DOI BAN
			//Ti.API.info('<<<<'+e.source.value)
			if(e.source.value==1)
			{
				Ti.App.fireEvent('OrderWindow:ChangeTable',{TableId:_args.TablesId,TableName:_args.TableName});
			}
        })
		return bt;
	}
	for (i = 0; i < bts.length; i++){
        var btadd=createButton(bts[i])
		view.add(btadd);
    }
	
	
	
	
	_args.egc.addEventListener('OrderTask:ChangeTableExcute', function (e) {
		
		_args.TablesId=e.TableId_New
		_args.TableName=e.TableName_New
		
	})
	
	
	
	return view;
}
